#include "common/defines.h"
#include "loginrequest.h"
#include "response/loginresponse.h"
#include "network/networkjsonresponse.h"
#include <json.h>


#include <QDebug>
#include <QUrl>


LoginRequest::LoginRequest(const QString &user,
                           const QString &password):
    m_response(new LoginResponse()),
    m_user(user),
    m_password(password)
{
}


LoginRequest::~LoginRequest()
{
    delete m_response;
    m_response = NULL;
}


QUrl LoginRequest::url() const
{
    QString url = QString(REST_LOGIN_REQUEST).arg(m_user, m_password);
    //qDebug() << "Login Request Url:";
    //qDebug() << url;
    return QUrl(url);
}


Network::JSONResponse &LoginRequest::jsonResponse()
{
    return *m_response;
}


const Network::JSONResponse &LoginRequest::jsonResponse() const
{
    return *m_response;
}
